package com.tpix;

import java.io.IOException;

import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HomeToDetailsServlet extends HttpServlet implements Servlet {
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		//get the information from the request
		String keyID = request.getParameter("whichphoto");
				
		// get reference to core object
		PixieCore core = (PixieCore)request.getSession().getAttribute("core");
		if (core == null) {
			core = new PixieCore();
			request.getSession().setAttribute("core", core);
		}
		
		
		if (keyID == null || keyID.equals("")) {
			response.sendRedirect("/home.jsp");
		}
		else  {
			response.sendRedirect("/detail.jsp?kind=Photo&id=" + keyID);
		}
	

	}

}
